class Person {
  name: string;
  age: number;
  constructor(name: string, age: number) {
    this.name = name;
    this.age = age;
  }

  // 重写valueOf方法
  valueOf() {
    return this.age;
  }
}

const p1 = new Person("张三", 18);
const p2 = new Person("李四", 20);
console.log(p1 > p2); // false
console.log(p1 < p2); // true
console.log(p1 === p2); // false

export {};
